<?php

class UserAction extends BaseAction{

	function verify(){
		  
		import('ORG.Util.Image');
		
        Image::buildImageVerify();
		
     }

	function __construct(){

		parent::__construct();

		if($this->uinfo ==0){

			//$this->error("您还没有登录无法操作",U('Public/login'));

			header("Location: ".U('Public/login')); 

			exit();

		}
		$company =M('Company')->where("uid=".$this->uinfo['uid'])->find();
		$this->assign('company',$company);
	}
	
    function suggest(){
	if(isset($_POST['submit'])){
		
		$Suggest = M('suggest');
		
		$data['title'] = $_POST['title'];
		
		$data['content'] = $_POST['content'];
		
		$data['contact'] = $_POST['contact'];
		
		if($result = $Suggest->add($data)){
        	
			header("Location: ".U('Public/login')); 
			
    	} else {
       		header("Location: ".U('User/suggest')); 
  		}
		
	}else{
			$this->display();
		}
	}

	

	function tips(){

		

		$this->display();

	}

	function getusertype($type){

	  	 switch($type){

  	 	case 0:

  	 		return '个人会员';

  	 		break;

  	 	case 1:

  	 		return '企业会员';

  	 		break;	

  	 	case 2:

  	 		return 'VIP黄金版';

  	 		break;	

  	 	case 3:

  	 		return 'VIP尊贵版';

  	 		break;

  	 	case 4:

  	 		return 'VIP旗舰版';

  	 		break;		

  	 	

  	 }

		

	}

    /**

     * 

     * Enter description here ...

     * @param $type 类型

     * @param $info

     * @param $price

     */

	function payTips($type,$info,$price){

		  $data['uid']=$this->uinfo['uid'];

		  $data['type']=$type;

		  $data['info']=$info;

		  $data['price']=$price;

		  $data['createtime']=mktime();

		  M('Pay')->add($data);

	}

	function index(){

		$year = date("Y");
        $month = date("m");
        $day = date("d");
        $dayBegin = mktime(0,0,0,$month,$day,$year);//当天开始时间戳
        $dayEnd = mktime(23,59,59,$month,$day,$year);//当天结束时间戳

      
		$this->mycity =M('City')->where("id=".$this->uinfo['cityid'])->getField("city");

		//$number =checkUserRating($this->uinfo['type']);
        if ($this->uinfo['usertype'] == '4'){
           $number = 100;
        }else{
           $number = 1;
        }

		$tiezi =M('Zhaopin')->where("uid=".$this->uinfo['uid']." AND createtime>".$dayBegin." AND createtime <".$dayEnd)->count();


		$fabu = $number - $tiezi;

		$this->usertype =$this->getusertype($this->uinfo['usertype']);

		$this->assign("fabu",$fabu);

		$this->assign("number",$number);

		$this->assign("tiezi",$tiezi);

		$this->display();

	}

	

	/**

	 * 充值记录

	 * Enter description here ...

	 */

	function paylist(){
       
		  $type = $_GET['type'];
		
		  import('ORG.Util.Page');// 导入分页类
		
		    $count0      = M('pay')->where("type=0 and uid=".$this->uinfo['uid'])->count();// 查询满足要求的总记录数
 
		    $page0       = new Page($count0,25);// 实例化分页类 传入总记录数和每页显示的记录数	
		
			$show0       = $page0->show();// 分页显示输出
		
			$list0 = M('pay')->where("uid=".$this->uinfo['uid'])->order('id DESC')->limit($page0->firstRow.','.$page0->listRows)->select();

			
			
			
		    $count1      = M('pay')->where("type=1 and uid=".$this->uinfo['uid'])->count();// 查询满足要求的总记录数

			$page1       = new Page($count1,25);// 实例化分页类 传入总记录数和每页显示的记录数	
			
			$show1       = $page1->show();// 分页显示输出
			
			$list1 = M('pay')->where("type=1 and uid=".$this->uinfo['uid'])->order('id DESC')->limit($page1->firstRow.','.$page1->listRows)->select();
		    

		$this->assign("list0",$list0);
		
		$this->assign("page0",$show0);
		
		$this->assign("list1",$list1);
		
		$this->assign("page1",$show1);

		$this->assign("type",$type);
		
		$this->display();

	}

	
	/**

	 * 支付

	 * Enter description here ...

	 */

	function pay(){

		if(isset($_POST['submit'])){
             $data['orderID'] = getOrderNumber();
             $data['price'] = $_POST['price'];
              $data['createtime']=mktime();
              $data['status']=  0;
              $data['uid']=$this->uinfo['uid'];
              if(M('Order')->add($data)){

              	 $url = U('Pay/dopay')."&WIDout_trade_no=".$data['orderID']."&WIDsubject=在线充值&WIDtotal_fee=".$data['price']."&WIDbody=网友在线充值";
			    
			     header("Location:".$url); 
		        $this->success("充值成功");
              }
			

		}else{

		$this->display();

		}

	}

	
	function pay1(){

		if(isset($_POST['submit'])){

			M('User')->where("uid=".$this->uinfo['uid'])->setInc("price",$_POST['price']);

		   $this->success("充值成功");	

		}else{

		$this->display();

		}

	}
	

	/**

	 * VIP会员

	 * Enter description here ...

	 */

	function vip(){
		
			if(isset($_POST['submit'])){
				
			  $price =$this->getUserPirce($usertype); //升级需要的金额

			  $myprice = $this->uinfo['price'];

			  if($myprice >= $price){

			  	  //扣除账户上的金额 修改用户等级VIP设置为1

			  	  $data['price'] = $myprice - $price; //剩余金额

			  	  $data['vip'] = 1;

			  	  $data['usertype']=$usertype;

			  	  if(M('User')->where("uid=".$this->uinfo['uid'])->save($data)){

			  	  	 //更新企业表信息

			  	  	 M('company')->where("uid=".$this->uinfo['uid'])->save(array('vip'=>1,'category'=>$usertype));

			  	  	 //写入财务记录

			  	  	 M('Pay')->add(array('uid'=>$this->uinfo['uid'],'type'=>0,'price'=>$price,'info'=>'升级一年'.$this->getusertype($usertype).'会员','createtime'=>mktime()));

			  //	  	 $this->success("升级成功！");
			  		header("Location: ".U('User/index'));

			  	  }

			  }else{

			 // 	$this->error("账户金币不够 无法升级");

			  } 	
		
		
		
				}else{
				    $this->usertype =$this->getusertype($this->uinfo['usertype']);
					$price = $this->uinfo['price'];
					$this->assign('price',$price);
					$this->display();
			
				}
		

		/*
		if(isset($_POST['submit'])){

			$usertype= $_POST['ddlrole'];

			if(empty($usertype)){

				$this->error("请选择升级类型");

			}else{

			  $price =$this->getUserPirce($usertype); //升级需要的金额

			  $myprice = $this->uinfo['price'];

			  if($myprice >= $price){

			  	  //扣除账户上的金额 修改用户等级VIP设置为1

			  	  $data['price'] = $myprice - $price; //剩余金额

			  	  $data['vip'] = 1;

			  	  $data['usertype']=$usertype;

			  	  if(M('User')->where("uid=".$this->uinfo['uid'])->save($data)){

			  	  	 //更新企业表信息

			  	  	 M('company')->where("uid=".$this->uinfo['uid'])->save(array('vip'=>1,'category'=>$usertype));

			  	  	 //写入财务记录

			  	  	 M('Pay')->add(array('uid'=>$this->uinfo['uid'],'type'=>0,'price'=>$price,'info'=>'升级一年'.$this->getusertype($usertype).'会员','createtime'=>mktime()));

			  //	  	 $this->success("升级成功！");

			  	  }

			  }else{

			  	

			 // 	$this->error("账户金币不够 无法升级");

			  } 	

				

			}

		}else{
		

			$this->usertype =$this->getusertype($this->uinfo['usertype']);
			$price = $this->uinfo['price'];
			$this->assign('price',$price);
		$this->display();

		}
*/
	}
	
	

	/**

	 * 获取用户升级金额

	 * Enter description here ...

	 */

	function getUserPirce($type){

		  	 switch($type){

  	 

  	 	case 2:

  	 		return 12000;

  	 		break;	

  	 	case 3:

  	 		return 26800;

  	 		break;

  	 	case 4:

  	 		return 38800;

  	 		break;		

  	   }

	}

	

	

	function edit(){
		
		if(isset($_POST['tijiao'])){
			
		$data = array('notice'=>'','cityid'=>$_POST['cityid'],'status'=>'0','address'=>$_POST['address'],'name'=>$_POST['name'],'phone'=>$_POST['phone'],'product'=>$_POST['product'],'mobile'=>$_POST['mobile'],'contact'=>$_POST['contact']);
		
		if(M('company')->where("uid=".$this->uinfo['uid'])->setField($data)){
      	     	header("Location: ".U('User/index'));
		   }else{
		       header("Location: ".U('User/edit'));
		   }
			 

		}else{

			

			 $this->list =M('City')->where("status=0 AND city != '' ")->order("initial ASC")->select();

			 $this->display();

		}


	}

	

	/**

	 * 信息列表

	 * Enter description here ...

	 */

	function infolist(){

		   $top = I('get.top');
		   $sql ="";
		    switch (intval($top)){
                case 1:
                    $sql = array('uid'=>$this->uinfo['uid'],'top'=>array('in','1,2'));
                   break;
                case 2:
                    $sql = array('uid'=>$this->uinfo['uid'],'top'=>array('in','3,4'));
                    break;
                default:
                    $sql= array('uid'=>$this->uinfo['uid']);
                    break;
            }


			import('ORG.Util.Page');// 导入分页类

			$count      = M('Zhaopin')->where($sql)->count();// 查询满足要求的总记录数

			$Page       = new Page($count,20);// 实例化分页类 传入总记录数和每页显示的记录数

			$show       = $Page->show();// 分页显示输出

			// 进行分页数据查询 注意limit方法的参数要使用Page类的属性

			$temp =M('Zhaopin')->where($sql)->order('createtime DESC')->limit($Page->firstRow.','.$Page->listRows)->select();

		   foreach ($temp as $v){

	       $v['cate'] =M('Category')->where("id=".$v['cid'])->getField("path");

	       $v['city'] =M('City')->where("id=".$v['cityid'])->getField("pinyin");

	       $list[]=$v;

	       }
	       
	       		$price = $this->uinfo['price'];
		$this->assign('price',$price);

	    $this->assign("list",$list);

			$this->assign('list',$list);// 赋值数据集

			$this->assign('page',$show);// 赋值分页输出

            $this->assign("top",$top);

		  

		  $this->display();

	}

	

	/**

	 * 编辑信息

	 * Enter description here ...

	 */

	function editinfo(){

		$id = empty($_GET['id'])?exit():$_GET['id'];

		if(isset($_POST['submit'])){

			 M('Zhaopin')->where("id=".$id)->save($_POST);

			header("Location: ".U('User/infolist'));  exit();

		}else{

			$this->li= M('Zhaopin')->where("id=".$id)->find();

			$this->display();

		}

	}

	

	/**

	 * 删除信息

	 * Enter description here ...

	 */

	function delinfo(){

		$id = empty($_GET['id'])?exit():$_GET['id'];

		M('Zhaopin')->where("id=".$id)->delete();

		header("Location: ".U('User/infolist'));  exit();

	}

	

	

	/**

	 * 信息提前

	 * Enter description here ...

	 */

	function upinfo(){

	    $golds = 30;//扣除金币数
		$id = empty($_GET['id'])?exit():$_GET['id'];

		//如果不是VIP

		$vip = $this->uinfo['vip'];

		if($vip == 0){

		   $price = $this->uinfo['price'];

		   if($price >= $golds){

		   	  M('User')->where("uid=".$this->uinfo['uid'])->setDec("price",$golds);

		   	  M('Zhaopin')->where("id=".$id)->save(array('createtime'=>mktime()));

		   	  //写入记录

		   	  $this->payTips(0, "刷新信息扣除金币".$golds."个", $golds);

		   	 // $this->success("操作成功");
		   	    header("Location: ".U('infolist'));

		   }else{

		   	

		   	$this->error("信息提前需要扣除".$golds."个金币 账户余额不足");

		   }

		}else{

			//如果是VIP

            $price = $this->uinfo['price'];

            if($price >= 10){

                M('User')->where("uid=".$this->uinfo['uid'])->setDec("price",10);

                M('Zhaopin')->where("id=".$id)->save(array('createtime'=>mktime()));

                //写入记录

                $this->payTips(0, "刷新信息扣除金币10个", 10);

                // $this->success("操作成功");
                header("Location: ".U('infolist'));

            }else{



                $this->error("信息提前需要扣除10个金币 账户余额不足");

            }



		}

		

	}

	

	/**

	 * 信息置顶

	 * Enter description here ...

	 */

	function topinfo(){

	  $id = empty($_GET['id'])?exit():$_GET['id'];



		if(isset($_POST['submit'])){

            $arr =  $this->getPriceType($_POST['price']);
            $times = $arr['time'];
            $top = $arr['top'];
			if($this->uinfo['price'] >= $arr['price']){

				  //置顶操作



				   M('Zhaopin')->where("id=".$id)->save(array('top'=>$top,'toptime'=>$times));


				  //扣钱

				  M('User')->where("uid=".$this->uinfo['uid'])->setDec("price",$arr['price']);



				   $this->payTips(0, "信息置顶扣除金币".$arr['price']."个", $arr['price']);
					
				   header("Location: ".U('infolist'));
			}else{

				header("Location: ".U('User/pay'));
			}
		
		}else{
		

			$li =M('Zhaopin')->where("id=".$id)->find();
			$price = $this->uinfo['price'];
			$this->assign('price',$price);
			$this->assign('li',$li);
			$this->display();

		} 

		

	}

	function hurry(){
        $id = empty($_GET['id'])?exit():$_GET['id'];
        if(isset($_POST['submit'])){

            $arr =  $this->getPriceType($_POST['price']);
            $times = $arr['time'];
            $top = $arr['top'];
            if($this->uinfo['price'] >= $arr['price']){
                //置顶操作

                M('Zhaopin')->where("id=".$id)->save(array('top'=>$top,'toptime'=>$times));
                //扣钱

                M('User')->where("uid=".$this->uinfo['uid'])->setDec("price",$arr['price']);

                $this->payTips(0, "十万火急扣除金币".$arr['price']."个", $arr['price']);

                header("Location: ".U('infolist'));
            }else{

                header("Location: ".U('User/pay'));
            }

        }else{


            $li =M('Zhaopin')->where("id=".$id)->find();
            $price = $this->uinfo['price'];
            $this->assign('price',$price);
            $this->assign('li',$li);
            $this->display();

        }

    }

	

	function getPriceType($price){
        if(empty($price)){
            exit();
        }else{
            $arr = explode("|",$price);
            $time = time()+ (intval($arr[2])*60*60*24);
            return array('top'=>$arr[1],'time'=>$time,'price'=>$arr[0]);
        }

    }

	function checkVip(){

		

	 if($this->uinfo['vip']!=1){

			 

	           header("location:".U('User/tips'));

		}

	}

	

	/**

	 * 商务通设置

	 * Enter description here ...

	 */

	function company(){

		$this->checkVip();



		if(isset($_POST['submit'])){

			 M('Company')->where("uid=".$this->uinfo['uid'])->save($_POST);

			header("Location: ".U('User/index'));  exit(); 

		}else{

		

			$this->display();

		}	

	}

	

	/**

	 * 推荐产品

	 * Enter description here ...

	 */

	function product(){

		$this->checkVip();

	    if(isset($_POST['submit'])){

			 M('Company')->where("uid=".$this->uinfo['uid'])->save($_POST);

			 $this->success("设置成功"); 

		}else{

			

			$this->display();

		}		

		

		

	}

	

	/**

	 * 企业动态

	 * Enter description here ...

	 */

	function news(){

		$this->checkVip();

	  	import('ORG.Util.Page');// 导入分页类

		$count      = M('CompanyNews')->where("uid=".$this->uinfo['uid'])->count();// 查询满足要求的总记录数

		$Page       = new Page($count,25);// 实例化分页类 传入总记录数和每页显示的记录数

		$show       = $Page->show();// 分页显示输出

		// 进行分页数据查询 注意limit方法的参数要使用Page类的属性

		$list = M('CompanyNews')->where("uid=".$this->uinfo['uid'])->order('id DESC')->limit($Page->firstRow.','.$Page->listRows)->select();

		$this->assign('list',$list);// 赋值数据集

		$this->assign('page',$show);// 赋值分页输	  	

	  	$this->display();

	}

	

	function addnews(){
		if(isset($_POST['submit'])){
			
			$data = $_POST;

			$data['uid']=$this->uinfo['uid'];

			$data['status']=1;

			$data['company_id']=$this->company['id'];

			$data['createtime']= mktime();
			
			  if($id = M('company_news')->add($data)){
 	  	  	 	
 	  	  	 	 header("Location: ".U('User/news'));
 	  	  	 	
 	  	  	 }else{
 	  	  	 	header("Location: ".U('User/addnews'));
 	  	  	 	
 	  	  	 }
 	  	  	 
		}else{
			
			$this->display();
			
		}

}

	

	

	function editnews(){

		$id = empty($_GET['id'])?exit():$_GET['id'];

		if(isset($_POST['submit'])){

			$data = $_POST;

			$data['uid']=$this->uinfo['uid'];

			$data['status']=1;

			$data['company_id']=$this->company['id'];

			//$data['createtime']= mktime();

			if(M('CompanyNews')->where("id=".$id)->save($data)){

				header("Location: ".U('User/news'));exit();

			}else{
				
			     header("Location: ".U('User/editnews'));exit();
			}

			

		}else{

		   $this->li =M('CompanyNews')->where("id=".$id)->find();

		   $this->display();	

		}	

	}
	
	
	/*
	 * 删除公司新闻
	 */
	function delnews(){
		$id = empty($_GET['id'])?exit():$_GET['id'];
		if(M('CompanyNews')->where('id='.$id)->delete()){
			header("Location: ".U('User/news'));exit();
			
		}		
	}
	

	/*
	 * 

	 * 荣誉

	 * Enter description here ...

	 */

	function rongyu(){

	  	$this->checkVip();

	  	

	  	import('ORG.Util.Page');// 导入分页类

		$count      = M('CompanyRongyu')->where("uid=".$this->uinfo['uid'])->count();// 查询满足要求的总记录数

		$Page       = new Page($count,25);// 实例化分页类 传入总记录数和每页显示的记录数

		$show       = $Page->show();// 分页显示输出

		// 进行分页数据查询 注意limit方法的参数要使用Page类的属性

		$list = M('CompanyRongyu')->where("uid=".$this->uinfo['uid'])->order('id DESC')->limit($Page->firstRow.','.$Page->listRows)->select();

		

		$this->assign('list',$list);// 赋值数据集

		$this->assign('page',$show);// 赋值分页输	  	

	  	$this->display();

	}

	

	

	function addrongyu(){

		if(isset($_POST['submit'])){

			$data = $_POST;

			$data['uid']=$this->uinfo['uid'];

			$data['status']=1;

			$data['company_id']=$this->company['id'];

			$data['createtime']= mktime();

			if(M('CompanyRongyu')->add($data)){
				
				 header("Location: ".U('User/rongyu'));exit();

			}else{
				
				header("Location: ".U('User/addrongyu'));exit();
			}

		}else{

		   $this->display();	

		}

	

	}

	//**编辑荣誉

	

	function editrongyu(){

		$id = empty($_GET['id'])?exit():$_GET['id'];

		if(isset($_POST['submit'])){

			$data = $_POST;

			$data['uid']=$this->uinfo['uid'];

			$data['status']=1;

			$data['company_id']=$this->company['id'];

			$data['createtime']= mktime();

			if(M('CompanyRongyu')->where("id=".$id)->save($data)){

			    header("Location: ".U('User/rongyu'));exit();

			}else{
				
				header("Location: ".U('User/editrongyu'));exit();
			}

			

		}else{

			$this->li =M('CompanyRongyu')->where("id=".$id)->find();

		   $this->display();	

		}

	

	}	

	
	/*
	 * 删除公司荣誉
	 */
	function delrongyu(){
		$id = empty($_GET['id'])?exit():$_GET['id'];
		if(M('CompanyRongyu')->where('id='.$id)->delete()){
			header("Location: ".U('User/rongyu'));exit();
			
		}		
	}
	
	
	
	
	/**

	 * 留言

	 * Enter description here ...

	 */

	function feedback(){

		$this->checkVip();

	  	import('ORG.Util.Page');// 导入分页类

		$count      = M('CompanyFeedback')->where("company_id=".$this->company['id'])->count();// 查询满足要求的总记录数

		$Page       = new Page($count,25);// 实例化分页类 传入总记录数和每页显示的记录数

		$show       = $Page->show();// 分页显示输出

		// 进行分页数据查询 注意limit方法的参数要使用Page类的属性

		$list = M('CompanyFeedback')->where("company_id=".$this->company['id'])->order('id DESC')->limit($Page->firstRow.','.$Page->listRows)->select();
		
		$this->assign('list',$list);// 赋值数据集

		$this->assign('page',$show);// 赋值分页输	  	

	  	$this->display();

	}

	

	function viewfeedback(){

		$this->li =M('CompanyFeedback')->where("id=".$_GET['id'])->find();

		$this->display();

	}
	
	/**
	 * 修改密码
	 * Enter description here ...
	 */
	function repass(){
		if(isset($_POST['sumbmit'])){
			
			$data["password"] = md5($_POST["pwd2"]);
			if( M('User')->where("uid=".$this->uinfo['uid'])->setField('password',$data["password"])){
      	     	header("Location: ".U('User/index'));
		   }else{
		       header("Location: ".U('User/repass'));
		   }
		   }else{
				$this->display();
			}
		}
	
		  
	 function getcity(){
		   $id = $_GET['id'];
		   $list = M('city')->where("cid=".$id)->select();
		    echo(json_encode($list));
		 
		 } 	

	/*检查密码*/
	function checkpwd(){
	
	 $count = M('User')->where("password='".md5($_GET['pwd'])."'")->count();

		  if($count > 0 ){

		  	 echo 1;

		  }else{
		  	
		  	echo 0;
		  }
		

	}

	/*
	 * 检查我的站点
	 */
	function checksite(){
		$id = $_GET['id'];
		   $list = M('Company')->where("id=".$id)->find();
		    echo(json_encode($list));
		
	}


    function shenfen(){
        $uid = $this->uinfo['uid'];
        if(isset($_POST['submit'])){
            $data = $_POST;
            $data['status'] = 2;
            $data['uid'] = $uid;
            M('Renzheng')->add($data);
            $this->success("操作成功！");
        }else{
            $info = M('Renzheng')->where(array('uid'=>$uid))->find();
            if(empty($info)){
                $this->assign("renzheng",0);
            }else{
                $this->assign("renzheng",$info['status']);
            }
            $this->assign("info",$info);
            $this->display();
        }

    }

    function phone(){
        $uid = $this->uinfo['uid'];
        if(isset($_POST['submit'])){
            $code = I('post.code');
            $phone = I('post.phone');

            if($code == $_COOKIE['code']){
                M('User')->where(array('uid'=>$uid))->save(array('phone'=>$phone)) ;
                $this->success("认证通过！");
            }else{
                $this->error("手机验证码错误");
            }
        }else{

            $info = M('User')->where(array('uid'=>$uid))->find();
            if(empty($info['phone'])){
                $this->assign("renzheng",0);
            }else{
                $this->assign("renzheng",1);
            }
            $this->assign("info",$info);
            $this->display();
        }
    }

    function send(){
        $code = rand(1111,9999);
        cookie("code",$code);
        $phone = I('post.phone');
        $tools = new ToolsModel();
        $info ="您正在进行实名认证操作,您的验证码是:".$code." 如非本人操作可以忽略";
        $tools->sendmsg($phone,$info);
        $this->ajaxReturn(array('status'=>1,'msg'=>'验证码已经发送到您的手机'));
    }

    function addauto(){
        $id = I('get.id');
        M('Zhaopin')->where(array('id'=>$id))->setField("auto",1);
        $this->success("操作成功",U('auto'));
    }

    function auto(){


        $sql= "auto = 1 AND uid=".$this->uinfo['uid'];



        import('ORG.Util.Page');// 导入分页类
        $count      = M('Zhaopin')->where($sql)->count();// 查询满足要求的总记录数
        $Page       = new Page($count,20);// 实例化分页类 传入总记录数和每页显示的记录数
        $show       = $Page->show();// 分页显示输出
        // 进行分页数据查询 注意limit方法的参数要使用Page类的属性

        $temp =M('Zhaopin')->where($sql)->order('createtime DESC')->limit($Page->firstRow.','.$Page->listRows)->select();
        foreach ($temp as $v){

            $v['cate'] =M('Category')->where("id=".$v['cid'])->getField("path");

            $v['city'] =M('City')->where("id=".$v['cityid'])->getField("pinyin");

            $list[]=$v;

        }



        $price = $this->uinfo['price'];
        $this->assign('price',$price);



        $this->assign('list',$list);// 赋值数据集

        $this->assign('page',$show);// 赋值分页输出

        $this->display();

    }


    function qiye(){
        import('ORG.Util.Page');// 导入分页类
        $sql = array('status'=>1);

        $count      = M('Company')->where($sql)->count();// 查询满足要求的总记录数

        $Page       = new Page($count,25);// 实例化分页类 传入总记录数和每页显示的记录数

        $show       = $Page->show();// 分页显示输出

        // 进行分页数据查询 注意limit方法的参数要使用Page类的属性

        $list = M('Company')->where($sql)->order('id DESC')->limit($Page->firstRow.','.$Page->listRows)->select();

        $this->assign('list',$list);// 赋值数据集

        $this->assign('page',$show);// 赋值分页输

        $this->display();
    }


}

?>